<?php

/**
 * LicenseeMatch filter form base class.
 *
 * @package    symfony
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseLicenseeMatchFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'licensee_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Licensee01'), 'add_empty' => true)),
      'datetime_match'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'status'                   => new sfWidgetFormChoice(array('choices' => array('' => '', 'D' => 'D', 'V' => 'V'))),
      'opponent_lastname'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'opponent_firstname'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'opponent_point'           => new sfWidgetFormFilterInput(),
      'opponent_licensee_number' => new sfWidgetFormFilterInput(),
      'match_type_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MatchType'), 'add_empty' => true)),
      'created_at'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'licensee_id'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Licensee01'), 'column' => 'id')),
      'datetime_match'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'status'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('D' => 'D', 'V' => 'V'))),
      'opponent_lastname'        => new sfValidatorPass(array('required' => false)),
      'opponent_firstname'       => new sfValidatorPass(array('required' => false)),
      'opponent_point'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'opponent_licensee_number' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'match_type_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('MatchType'), 'column' => 'id')),
      'created_at'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('licensee_match_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LicenseeMatch';
  }

  public function getFields()
  {
    return array(
      'id'                       => 'Number',
      'licensee_id'              => 'ForeignKey',
      'datetime_match'           => 'Date',
      'status'                   => 'Enum',
      'opponent_lastname'        => 'Text',
      'opponent_firstname'       => 'Text',
      'opponent_point'           => 'Number',
      'opponent_licensee_number' => 'Number',
      'match_type_id'            => 'ForeignKey',
      'created_at'               => 'Date',
      'updated_at'               => 'Date',
    );
  }
}
